-
Notifications
You must be signed in to change notification settings - Fork 607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: track and query protocol rev across all modules #6804
Conversation
Important Notice This PR modifies an in-repo Go module. It is one of:
The dependent Go modules, especially the root one, will have to be Please follow the instructions below:
Please let us know if you need any help. |
…dified dependencies locally
@@ -0,0 +1,85 @@ | |||
package apptesting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The methods in the file are extracted from previously existing txfees helpers because they need to be used in other module tests, and I wanted to prevent code duplication.
@@ -114,3 +114,11 @@ func MergeCoinMaps[T comparable](currentEpochExpectedDistributionsOne map[T]sdk. | |||
} | |||
return newMap | |||
} | |||
|
|||
func ConvertCoinArrayToCoins(coinArray []sdk.Coin) sdk.Coins { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While coin arrays can be used in place of a coins object and still be valid, coin array do not posses the same sub methods (ex. Sub, Add, etc), so this method is useful imo.
@@ -19,7 +19,7 @@ func (s *KeeperTestSuite) TestChargeTakerFee() { | |||
|
|||
var ( | |||
defaultTakerFee = osmomath.MustNewDecFromStr("0.01") | |||
defaultAmount = sdk.NewInt(100) | |||
defaultAmount = sdk.NewInt(10000000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was increased because with a taker fee as small as 0.01 and an input of 100, the split between taker fee and community pool is too small to actually test. In other words, the taker fee is 1, and splitting this between the two does not work (in practice/mainnet what happens is, the first category of staking rounds it down to 0, and then the remainder (1) is all sent to the second category)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, left some minor nit comments, otherwise looks good to me! Nice work on implementing all this across the modules !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work 💪
Closes: #XXX
What is the purpose of the change
The Osmosis protocol now generates multiple streams of revenue:
We currently only explicitly track the cyclic arb profits. Calculating tx fees and taker fees is complicated, and tracking via the protocol itself at time of charge is much simpler.
This PR adds trackers to taker fees, tx fees, and a new cyclic arb tracker (the previous one didn't track the start height in which the profits began from), and implements a query in the protorev module that fetches and serves these values in a single query. The trackers themselves live in each respective module (taker fee tracker KVStore in poolmanager, tx fees KVStore in txfees, and cyclic arbs KVStore in protorev), with the caller that amalgamates these result living in the protorev module itself.
Testing and Verifying
Go tests added for all newly introduced logic
Documentation and Release Note
Unreleased
section ofCHANGELOG.md
?Where is the change documented?
x/{module}/README.md
)